Data in a relational or object-relational database is stored as relations comprising rows or tuples that share the same columns. There are several formats of storing rows, which are row-major and column-major. In row-major format, column values of a single row are stored contiguously within a unit of persistent storage, such as a data block. In column-major format, values of a column of multiple rows are stored contiguously. Row-major format or column-major format are collectively referred to herein as major formats.
Each major format has its advantageous. For example, column-major format is advantageous for queries that require scanning a single column to generate aggregate values for those columns. Such queries occur often in the context of data warehousing and decision support systems. On the other hand, row-major format is advantageous for queries that return rows with multiple columns or for modifications to a few number of rows. The major format of a column and the compression technique used, if any, is referred to herein as a storage format.
Described herein are techniques that provide advantages of both row-major and column-major format.